package com.george.shiro.model.controller;

import com.george.shiro.util.ResultUtil;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * <p>
 *  页面跳转Controller
 * </p>
 *
 * @author GeorgeChan 2019/5/26 15:00
 * @version 1.0
 * @since jdk1.8
 */
@Controller
public class RenderController {

    /**
     * 首页
     * @return
     */
    @GetMapping("/index")
    public ModelAndView home() {
        return ResultUtil.view("index");
    }

    /**
     * 用户列表
     * @return
     */
    @RequiresPermissions("users")
    @GetMapping("/users")
    public ModelAndView user() {
        return ResultUtil.view("user/list");
    }

    /**
     * 资源列表
     * @return
     */
    @RequiresPermissions("resources")
    @GetMapping("/resources")
    public ModelAndView resources() {
        return ResultUtil.view("resources/list");
    }

    /**
     * 角色列表
     * @return
     */
    @RequiresPermissions("roles")
    @GetMapping("/roles")
    public ModelAndView roles() {
        return ResultUtil.view("role/list");
    }
}
